//
//  LoginViewController.m
//  豆瓣电影app
//
//  Created by 洛洛大人 on 16/6/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LoginViewController.h"
#import "registeredViewController.h"
#import "UserViewController.h"

@interface LoginViewController ()

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
  
    self.navigationItem.title = @"用户登录";
    
    [self creatView];
}

-(void)viewWillAppear:(BOOL)animated{
    
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.41 green:0.61 blue:0.68 alpha:1];
}

-(void)creatView{
    UILabel *label1 = [[UILabel alloc]initWithFrame:CGRectMake(50, 200, 100, 50)];
    [self.view addSubview:label1];
    label1.font = [UIFont systemFontOfSize:25.0];
    
     label1.text = @"用户名:";
    
    UILabel *label2 = [[UILabel alloc]initWithFrame:CGRectMake(label1.frame.origin.x, label1.frame.origin.y + 100, 100, 50)];
    label2.font = [UIFont systemFontOfSize:25.0];
    [self.view addSubview:label2];
    label2.text = @"密码:";
    
    UITextField *textfield1 = [[UITextField alloc]initWithFrame:CGRectMake(label1.frame.origin .x + 120, label1.frame.origin.y, 200, 50)];
    [self.view addSubview:textfield1];
    
    textfield1.font = [UIFont systemFontOfSize:25];
    textfield1.placeholder = @"请输入用户名";

    textfield1.borderStyle = UITextBorderStyleRoundedRect;
    
    UITextField *textfield2 = [[UITextField alloc]initWithFrame:CGRectMake(label1.frame.origin.x + 120, label1.frame.origin.y + 100, 200, 50)];
    [self.view addSubview:textfield2];
    textfield2.font = [UIFont systemFontOfSize:25];
    textfield2.placeholder = @"请输入密码";
    textfield2.borderStyle = UITextBorderStyleRoundedRect;
    
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeSystem];
    button1.frame = CGRectMake(50, 400, 130, 50);
    [self.view addSubview:button1];
    button1.backgroundColor = [UIColor greenColor];
    [button1 setTitle:@"登录" forState:UIControlStateNormal];
    [button1 addTarget:self action:@selector(button1Action:) forControlEvents:UIControlEventTouchUpInside];
    
    UIButton *button2 = [UIButton buttonWithType:UIButtonTypeSystem];
    button2.frame = CGRectMake(220, 400, 130, 50);
    
    [self.view addSubview:button2];
    button2.backgroundColor = [UIColor orangeColor];
    [button2 setTitle:@"注册" forState:UIControlStateNormal];
    [button2 addTarget:self action:@selector(button2Action:) forControlEvents:UIControlEventTouchUpInside];
    
    
    
    
}

-(void)button1Action:(UIButton *)button1 {
    UserViewController *userVC = [[UserViewController alloc]init];
    
    [self.navigationController pushViewController:userVC animated:YES];
    
    
    
}

-(void)button2Action:(UIButton *)button2 {
    
    registeredViewController *registredVC = [[registeredViewController alloc]init];
    [self.navigationController pushViewController:registredVC animated:YES];
    
}







- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
